<?php

Route::group([
    'prefix' => 'admin',
    'middleware' => ['api'],
    'as' => 'admin::'
],function (){
    Route::group([
        'namespace' => 'Auth',
        'prefix' => 'auth',
    ],function (){
        Route::post('/login', 'LoginController@login')->name('login');
        Route::post('/forgot/getCode', 'ForgotPasswordController@getCode')->name('forgot.getCode');
        Route::post('/forgot/checkCode', 'ForgotPasswordController@checkCode')->name('forgot.checkCode');
        Route::group([
            'middleware' => 'check.jwt:admin',
            ],function (){
            Route::post('/logout', 'LoginController@logout')->name('logout');
        });
    });

    Route::group([
        'namespace' => 'Administrator',
        'middleware' => ['admin'],
    ],function (){
        /// 权限
        Route::get('/permissions', 'PermissionController@index')->name('permissions.index');
        Route::get('/permissions/import', 'PermissionController@import')->name('permissions.import');

        /// 角色管理
//        Route::resource('roles', 'RoleController');
        Route::resource('departments','DepartmentController');

        /// 用户管理
//删除了        Route::get('users/self', 'UserController@showSelf')->name('users.self');
//删除了        Route::get('users/self/permissions', 'UserController@showSelfPermissions')->name('users.selfPermissions');
        Route::resource('users', 'UserController')->parameter('users', 'admin_user');

    });

    Route::group([
        'namespace' => 'System',
        'middleware' => ['admin'],
        'prefix' => 'system',
    ],function (){
        /// 菜单管理
        Route::post('/menu/order', 'MenuController@order')->name('menu.order');
        Route::resource('menu', 'MenuController');

        /// 操作日志
        Route::get('/logs', 'LogController@index')->name('logs.index');

        /// 上传文件
        Route::post('/upload/img', 'UploadController@uploadImg')->name('upload.img');

    });

//    Route::group([
//        'namespace' => 'Organizes',
//        'middleware' => ['admin'],
//    ],function (){
//        /// 组织菜单管理
//        Route::post('organizes/menu/order', 'OrganizeMenuController@order')->name('organizes_menu.order');
//        Route::resource('organizes/menu', 'OrganizeMenuController')->names('organizes_menu');
//
//        /// 组织权限
//        Route::get('organizes/permissions/import', 'OrganizePermissionController@import')->name('organizes_permissions.import');
//        Route::get('organizes/permissions', 'OrganizePermissionController@index')->name('organizes_permissions.index');
//
//        /// 组织下成员管理
//        Route::resource('organizes/leaders', 'OrganizeLeaderController')->names('organizes_leaders');
//
//        /// 组织下角色管理
//        Route::resource('organizes/roles', 'OrganizeRoleController')->names('organizes_roles');
//
//        /// 组织管理
//        Route::resource('organizes', 'OrganizeController');
//
//
//        /// 上传文件
////        Route::post('/upload/img', 'UploadController@uploadImg')->name('upload.img');
//
//    });

    Route::group([
        'namespace' => 'BaseInfo',
        'middleware' => ['admin'],
        'prefix' => 'baseinfo',
    ],function (){
        /// 关于我们
        Route::get('/about', 'AboutController@show')->name('about.show');
        Route::post('/about', 'AboutController@store')->name('about.store');

    });

});